# $Id$
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Pierre Schmitz <pierre@archlinux.de>

pkgname=automoc4
pkgver=0.9.88
pkgrel=8
pkgdesc="Automatic moc for Qt4"
arch=('i686' 'x86_64')
url='http://www.kde.org/'
license=('custom')
depends=('qt4')
makedepends=('pkgconfig' 'cmake')
source=("http://download.kde.org/stable/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.bz2"
        'license.txt' 'fix-cmake-warnings.patch')
md5sums=('91bf517cb940109180ecd07bc90c69ec'
         '9014edbb7e2f02fe90b2db8707487bce'
         '65d8c4b8bb46ac408a8c3d5d82167f9b')

prepare() {
  mkdir -p build

# Fix CMake warnings with newer policies
  cd $pkgname-$pkgver
  patch -p1 -i ../fix-cmake-warnings.patch
}

build() {
  cd build
  cmake ../${pkgname}-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr
  make
}

package() {
  cd build
  make DESTDIR="${pkgdir}" install

  install -Dm644 "${srcdir}/license.txt" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
